package com.ailanyin.admin.service.impl;

import com.ailanyin.admin.service.SysMenuService;
import com.ailanyin.admin.service.SysPermissionService;
import com.ailanyin.admin.service.SysRoleService;
import com.ailanyin.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.Set;

/**
 * @author ailanyin
 * @version 1.0
 * @since 2021/10/15 0015 下午 15:56
 */
@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Autowired
    private SysRoleService sysRoleService;
    @Autowired
    private SysMenuService sysMenuService;

    @Override
    public Set<String> getRolePermission(SysUser user) {
        return sysRoleService.selectRolePermissionByUserId(user.getUserId());
    }

    @Override
    public Set<String> getMenuPermission(SysUser user) {
        return sysMenuService.selectMenuPermsByUserId(user.getUserId());
    }
}
